import { HttpResponse } from '@/utils/Http';
import PageService from '@/utils/PageService';
// API URL constants for robot configuration service
const API_BASE_URL = '/api';
const API_URLS = {
    ASK: `/ask`,
    QUERY_CHAT: (chat_id: string) => `/query_chat/${chat_id}`
};

@base.registerService("chat", API_BASE_URL)
export default class MappingService extends PageService {
    constructor(base_url: string){
        super(base_url);
    }

    async ask(question: string): Promise<HttpResponse> {
        return await this.post(API_URLS.ASK, {
            question: question
        });
    }

    // Get parameter value
    async queryChat(chat_id: string): Promise<HttpResponse> {
        const response = await this.get(API_URLS.QUERY_CHAT(chat_id), {}, false);
        return response;
    }
}